package com.jinhua.huaoj.judge.codesandbox;

import com.jinhua.huaoj.judge.codesandbox.impl.ExampleCodeSandBox;
import com.jinhua.huaoj.judge.codesandbox.impl.RemoteCodeSandBox;
import com.jinhua.huaoj.judge.codesandbox.impl.ThirdPartyCodeSandBox;
import lombok.Data;

/**
 * 代码沙箱工厂根据配置文件中的参数选择代码沙箱
 */
@Data
public class CodeSandBoxFactory {

private CodeSandBoxFactory(){

}


    public static CodeSandBox newInstance(String type) {
        switch(type){
            case "example":
                return new ExampleCodeSandBox();
            case "remote":
                return new RemoteCodeSandBox();
            case "thirdPart":
                return new ThirdPartyCodeSandBox();
            default:
                return new RemoteCodeSandBox();
        }


    }
}
